<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
// Drag through text with 'text-transform'. Shouldn't crash.
const kStyle = '#target { text-transform: uppercase; }';

selection_test(
    '<p id="target">&#xDF;xyz</p>', // "SSxyz"
    async function(selection) {
        const target = selection.document.getElementById('target');
        const x1 = selection.computeLeft(target);
        const x2 = x1 + target.offsetWidth;
        const y = selection.computeLeft(target) + target.offsetHeight / 2;

        if (!window.chrome || !chrome.gpuBenchmarking)
          throw 'This test requires chrome.gpuBenchmarking';

        return new Promise(resolve =>
            chrome.gpuBenchmarking.pointerActionSequence([{
              source: 'mouse',
              actions: [
                {name: 'pointerDown', x: x1, y: y},
                {name: 'pointerMove', x: x2, y: y},
                {name: 'pointerUp'}
              ]}], resolve));

    },
    '<p id="target">^\u00DFxyz|</p>');
</script>
